import { onMounted, onUnmounted, ref } from "vue"

const cusMouse = () => {
  const x = ref(0)
  const y = ref(0)
  const setPoint = (event:any) => {
    console.log(event)
    x.value = event.pageX
    y.value = event.pageY
  }
  onMounted(() => {
    window.addEventListener('mousemove', setPoint)
  })
  onUnmounted(() => {
    window.removeEventListener('mousemove', setPoint)
  })
  return {x, y}
}
export default cusMouse